Olaf fixes fp rounding problem that shows up on AMD64/Linux in testo.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 6 May 2005 20:50:05 +0000 (20:50 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 6 May 2005 20:50:05 +0000 (20:50 +0000)
gpsbabel/igc.c

index 37f98cee800afd9e2caa9d28c194cf0e02191ab3..33c1f22730d7e88bae0e47c2fd2b7d9415ec31f5 100644 (file)
@@ -518,8 +518,8 @@ static char *latlon2str(const waypoint * wpt)
     char lon_hemi = wpt->longitude < 0 ? 'W' : 'E';
     unsigned char lat_deg = fabs(wpt->latitude);
     unsigned char lon_deg = fabs(wpt->longitude);
-    unsigned int lat_min = (fabs(wpt->latitude) - lat_deg) * 60000 + 0.5;
-    unsigned int lon_min = (fabs(wpt->longitude) - lon_deg) * 60000 + 0.5;
+    unsigned int lat_min = rint((fabs(wpt->latitude) - lat_deg) * 60000);
+    unsigned int lon_min = rint((fabs(wpt->longitude) - lon_deg) * 60000);
 
     if (snprintf(str, 18, "%02u%05u%c%03u%05u%c",
                 lat_deg, lat_min, lat_hemi, lon_deg, lon_min, lon_hemi) != 17) {